<template>
	<view class="">
		<button @click="login">登录</button>
	</view>
</template>

<script>
import {loginAppByWechat} from '@/api/login.js'
export default {
	methods: {
		async login(){
			let {errMsg,code} = await uni.login({
				provider:'weixin',
				onlyAuthorize:true
			})
			if(errMsg == 'login:ok'){
				let res = await loginAppByWechat({
					js_code:code
				})
				console.log(res,'res')
			}
		}
	}
}	
</script>

<style>
</style>